package com.tankgame;

import java.util.Vector;

public class Hero extends Tank {

    Shot shot = null;
    Vector<Shot> shots = new Vector<>();

    public Hero(int x, int y) {
        super(x, y);
    }

    public void Fire() {
        if(shots.size() == 5){
            return;
        }
        switch (getDirect()) {
            case 0:
                shot = new Shot(getX() + 10, getY(), 0);
                break;
            case 1:
                shot = new Shot(getX() + 30, getY() + 10, 1);
                break;
            case 2:
                shot = new Shot(getX() + 10, getY() + 30, 2);
                break;
            case 3:
                shot = new Shot(getX(), getY() + 10, 3);
                break;
        }
        shots.add(shot);
        new Thread(shot).start();
    }
}
